<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript">
        var x=document.getElementsByName("myInput");
        alert(x.nodeType);
    </script>
</head>
<body>

<input name="myInput" type="text" size="20" /><br />
<input name="myInput" type="text" size="20" /><br />
<input name="myInput" type="text" size="20" /><br />
<br />
<input type="button" value="How many elements named 'myInput'?" />

</body>
</html>